﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ueEngine.Biz.Inf.Entities.DBSupport;
using System.ComponentModel.DataAnnotations;

namespace ueEngine.Biz.Inf.Entities
{
    public class Feedback : BaseEntity<Feedback>
    {
        public override Feedback Get(System.Linq.Expressions.Expression<Func<Feedback, bool>> where)
        {
            using (Context ctx = new Context())
            {
                var item = ctx.Feedback.FirstOrDefault(where);
                if (item != null)
                {
                    this.Admin = item.Admin;
                    this.FeedbackType = item.FeedbackType;
                    this.Id = item.Id;
                    this.IsProcess = item.IsProcess;
                    this.Message = item.Message;
                    this.ReferenceUri = item.ReferenceUri;
                    this.User = item.User;
                    this.WriteDate = item.WriteDate;
                    return this;
                }
                return null;
            }
        }

        #region Fileds
        [Column(TypeName="int")]
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Column(TypeName="varchar")]
        [StringLength(200)]
        public string User { get; set; }

        [Column(TypeName="datetime")]
        public DateTime WriteDate { get; set; }

        [Column(TypeName="int")]
        public int FeedbackType { get; set; }

        [Column(TypeName="varchar")]
        [StringLength(200)]
        public string ReferenceUri { get; set; }

        [Column(TypeName="nvarchar")]
        [StringLength(4000)]
        public string Message { get; set; }

        [Column(TypeName="bit")]
        public bool IsProcess { get; set; }

        [Column(TypeName="varchar")]
        [StringLength(200)]
        public string Admin { get; set; }
        #endregion
    }
}
